package com.jiyun.order.controller;


import com.jiyun.order.service.IPaymentMethodInfoService;
import com.jiyun.orders.pojo.PaymentMethodInfo;
import com.jiyun.orders.vo.ResultVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 付款方式信息表 前端控制器
 * </p>
 *
 * @author 1823.
 * @since 2025-02-12
 */
@RestController
@RequestMapping("/payment")
public class PaymentMethodInfoController {

    @Autowired
    private IPaymentMethodInfoService paymentMethodInfoService;


    @Operation(summary = "添加付款方式信息")
    @PostMapping("/addPaymentMethodInfo")
    public ResultVo addPaymentMethodInfo(@RequestBody PaymentMethodInfo paymentMethodInfo){
        paymentMethodInfoService.save(paymentMethodInfo);
        return ResultVo.ok();
    }

    @Operation(summary = "付款详情")
    @RequestMapping("/getPaymentMethodInfoByOrderId/{id}")
    public ResultVo getPaymentMethodInfo(@PathVariable Integer id){
        return ResultVo.ok(paymentMethodInfoService.getById(id));
    }
}
